<template>
	<div class="mydev">
		<div class="mydevItems" v-for="(item,index) in list" :key="index">
			<div class="mydevItems_box">
				<div class="mydevItems_box_top">
					<div class="mydevItems_box_top_left">
						{{item.type || ''}} {{item.number || ''}}
					</div>
					<div class="mydevItems_box_top_right" :class="'devColor'+ item.status">
						{{item.status | statusFilter}}
					</div>
				</div>
				<div class="mydevItems_box_bottom">
					{{item.address || ''}}| {{item.model || ''}}
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			}
		},
		onShow() {
			this.getUserEquipment()
		},
		filters: {
			statusFilter(v) {
				var s = ''
				// 1正常 2维修中 3报废 4故障
				switch (v) {
					case 1:
						s = '正常'
						break;
					case 2:
						s = '维修中'
						break;
					case 3:
						s = '报废'
						break;
					case 4:
						s = '故障'
						break;
				}
				return s
			}
		},
		methods: {
			// 我的设备
			async getUserEquipment() {
				console.log('list1',data)
				const {
					data
				} = await this.$request(this.$Api.userEquipment, {

				}, "POST")
				 console.log('list',data)
				if (data.code !== 0) return
				
				this.list = data.data.list
			},
		}
	}
</script>

<style lang="scss">
	.mydev {
		.mydevItems {
			padding: 0 28rpx;
			box-sizing: border-box;
			margin-top: 28rpx;

			border-radius: 12rpx;
		}

		.mydevItems_box {
			padding: 32rpx;
			box-sizing: border-box;
			background: #fff;

			.mydevItems_box_top {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.mydevItems_box_top_left {
					font-size: 32rpx;
					font-weight: bold;
				}
			}
		}

		.mydevItems_box_bottom {
			margin-top: 16rpx;
			color: #666;
		}

		.devColor1 {
			color: #2E61FF !important;

		}

		.devColor2 {
			color: #F5A623 !important;
		}

		.devColor3 {
			color: #D0021B !important;
		}

		.devColor4 {
			color: #D0021B !important;
		}
	}
</style>